clear;

positions=[0 0; ...
    1 0; ...
    0 1; ...
    1 1; ...
    0 1; ];
    

assert(2.5==calculateNumRTTrades(positions));

positions=[0 0; ...
    0.5 0; ...
    0 0.5; ...
    0.5 0.5; ...
    0 0.5; ];


assert(2.5==calculateNumRTTrades(positions));

positions=[0 0; ...
    -1 0; ...
    0 1; ...
    1 -1; ...
    0 1; ];
    
assert(4.5==calculateNumRTTrades(positions));

positions=[0 0; ...
    -0.5 0; ...
    0 0.5; ...
    0.5 -0.5; ...
    0 0.5; ];


assert(4.5==calculateNumRTTrades(positions));